package com.baiyue.entity;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldStrategy;
import com.baomidou.mybatisplus.enums.IdType;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.validation.annotation.Validated;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author WuBo
 */
@Data
@TableName("user")
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Validated
public class UserEntity implements Serializable {
    private static final long serialVersionUID = -5144055068797033748L;
    /**
     * 用户id,自增
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 用户名
     */
    private String username;
    /**
     * 密码
     */
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String password;

    /**
     * 角色类型：0-管理员，1-收银员
     */
    private Integer nickname;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 0 正常
     * 1 禁用
     * 2 已删除
     */
    private Integer status = 0;

    /**
     * 创建时间
     */
    private Date createdTime;

    /**
     * 创建人用户名
     */
    private String createdBy;

    /**
     * 更新时间
     */
    private Date updatedTime;

    /**
     * 更新人用户名
     */
    private String updatedBy;

    /**
     * 用户手机号
     */
    private String phone;

    /**
     * 用户账号中文名0
     */
    private String user;

    /**
     * 菜单id
     */
    @TableField(strategy = FieldStrategy.IGNORED,value = "menu_ids")
    private String menuIds;


    /**
     * 开始时间
     */
    @TableField(exist = false)
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String start;

    /**
     * 结束时间
     */
    @TableField(exist = false)
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String end;

    /**
     * 数据分页当前页
     */
    @TableField(exist = false)
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private Integer page;

    /**
     * 数据分页条数
     */
    @TableField(exist = false)
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private Integer size;

    /**
     * 排序字段
     */
    @TableField(exist = false)
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String sortField;

    /**
     * 排序顺序
     * desc  asc
     */
    @TableField(exist = false)
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String sortValue;

    public UserEntity(String username, String password, Integer nickname, String email, Integer status,
                      Date createdTime, String createdBy, Date updatedTime, String updatedBy, String phone,
                      String user,String menuIds, String start, String end, Integer page, Integer size,
                      String sortField, String sortValue) {
        this.username = username;
        this.password = password;
        this.nickname = nickname;
        this.email = email;
        this.status = status;
        this.createdTime = createdTime;
        this.createdBy = createdBy;
        this.updatedTime = updatedTime;
        this.updatedBy = updatedBy;
        this.phone = phone;
        this.user = user;
        this.menuIds = menuIds;
        this.start = start;
        this.end = end;
        this.page = page;
        this.size = size;
        this.sortField = sortField;
        this.sortValue = sortValue;
    }
}
